package com.srp.blockchain.mybatisplustest.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.srp.blockchain.mybatisplustest.entity.UserRoleEntity;
import com.srp.blockchain.mybatisplustest.mapper.UserRoleMapper;
import com.srp.blockchain.mybatisplustest.service.IUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * impl
 */
@Service
public class UserRoleService extends ServiceImpl<UserRoleMapper, UserRoleEntity> implements IUserRoleService {


    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public List<UserRoleEntity> getList() {
        LambdaQueryWrapper<UserRoleEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.last("limit 10");
        List<UserRoleEntity> list = list(queryWrapper);
        return list;
    }

    @Override
    public List<UserRoleEntity> getListXml() {
        return userRoleMapper.findAll();
    }
}
